package com.utils;

import java.util.List;

public class Page<T> {
	//总记录数
	private int totalCount;
	
	//页面大小,即每页显示记录数
	private int pageSize;
	
	//总页数
	private int totalPageCount;
	
	//当前页码
	private int currPageNo;
	
	//每页信息的集合
	private List<T> list;
	
	//页面大小
	private int basePageSize = 8;
	
	public int getBasePageSize() {
		return basePageSize;
	}

	public void setBasePageSize(int basePageSize) {
		this.basePageSize = basePageSize;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getTotalPageCount() {
		return totalPageCount;
	}

	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
		
		//给总页数赋值
		//this.totalPageCount = (int) Math.ceil((double)this.totalCount/(double)this.pageSize);
		this.totalPageCount =this.totalCount%this.pageSize==0?this.totalCount/this.pageSize:totalCount/this.pageSize+1;
	}

	public int getCurrPageNo() {
		return currPageNo;
	}

	public void setCurrPageNo(int currPageNo) {
//		if(currPageNo <= 0) {
//			this.currPageNo =1;
//		}else {
//			this.currPageNo = currPageNo;
//		}
//		
//		if(currPageNo >= this.currPageNo){
//			this.currPageNo = this.totalPageCount;
//		}else {
//			this.currPageNo = currPageNo;
//		}
		this.currPageNo = currPageNo;
	}

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}
	
}
